package com.the_last.controller;

import com.the_last.pojo.po.SportType;
import com.the_last.service.SportTypeService;
import com.the_last.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sport-type")
public class SportTypeController {
    @Autowired
    private SportTypeService sportTypeService;
    
    @GetMapping("/list")
    @PreAuthorize("hasAuthority('SPORT_TYPE_QUERY')")
    public Result<List<SportType>> list() {
        return sportTypeService.getAllSportTypes();
    }
}